package Main;

import Common.*;
import Constants.*;
import Forms.*;
import Utility.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Program extends MIDlet {

    private boolean _First;

    private static Program _Instance = null;
    private static Display _Display = null;     // The display for this MIDlet

    public Program() {
        _First = false;

        _Instance = this;
        _Display = Display.getDisplay(this);
        
        //LanguageLoader.ww(is);

        /*System.out.println("Configer有效？" + Configer.IsValid());
        String strLang = Configer.GetInstance().GetLanguage();
        System.out.println("配置使用语言？" + strLang);
        
        if (strLang.compareTo("zh-CN") != 0){
            System.out.println("设置使用语言zh-CN成功？" + Configer.GetInstance().SetLanguage("zh-CN"));
            System.out.println("配置使用语言？" + Configer.GetInstance().GetLanguage());
        }*/
    }

    public static Program GetInstance(){
        return _Instance;
    }

    public static Display GetDisplay(){
        return _Display;
    }

    public void startApp() {
        if (!_First) {
            /*

            // these are the images and strings for the choices.
            Image[] imageArray = null;

            try {
                // load the duke image to place in the image array
                Image duke = Image.createImage ("/midp/Whois/Icon.png");

                // these are the images and strings for the choices.
                imageArray = new Image[] {duke, duke, duke, duke};
            }
            catch (java.io.IOException err) {
                // ignore the image loading failure the application can recover.
            }

            String[] stringArray = {"Com", "Cn", "Net", "Mobi"};

            // create the list of choice groups.
            ChoiceGroup[] groups =
                {
                    new ChoiceGroup ("后缀：", ChoiceGroup.EXCLUSIVE, stringArray, imageArray),
                    //new ChoiceGroup ("Multiple", ChoiceGroup.MULTIPLE, stringArray, imageArray),
                    //new ChoiceGroup ("Pop-Up", ChoiceGroup.POPUP, stringArray, imageArray)
                };

            for (int iter = 0; iter < groups.length; iter++) {
                _MainForm.append (groups[iter]);
            }*/
            
            _Display.setCurrent(new MainForm());
        }
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}
